package jp.oesf.malfoy.ui;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.Toast;

public class ConfigUi extends Activity {

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.config);

		ArrayAdapter<CharSequence> adapterBkgroundFnt = ArrayAdapter.createFromResource(
				this, R.array.array_bkg,
				android.R.layout.simple_spinner_item);
		adapterBkgroundFnt.setDropDownViewResource(android.R.layout.simple_spinner_item);

		Spinner spinner11 = (Spinner) findViewById(R.id.spinner11);
		spinner11.setAdapter(adapterBkgroundFnt);
		spinner11.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

			public void onNothingSelected(AdapterView<?> parent) {

			}

			public void onItemSelected(AdapterView<?> parent,
					android.view.View view, int position, long id) {

		}
		});
}

	public void onClickBkgButton(View view) {
		alert("Caution", "開発中", true);
		// finish();
	}

	public void onClickFntButton(View view) {
		alert("Caution", "開発中", true);
		// finish();
	}


	public void onClickReturnButton(View view) {
		Intent intent = new Intent(this, MainUi.class);
		startActivity(intent);
		Toast.makeText(this, "メイン画面に戻ります", Toast.LENGTH_LONG).show();
		// finish();
	}

	public void alert(String title, String message, boolean positive) {
		AlertDialog.Builder builder = new AlertDialog.Builder(this);
		builder.setTitle(title);
		builder.setMessage(message);
		if (positive) {
			builder.setPositiveButton("OK",
					new DialogInterface.OnClickListener() {
						public void onClick(DialogInterface dialog, int which) {
//							Toast.makeText(UI.this, "Hello!!",
//									Toast.LENGTH_LONG).show();
						}
					});
		}
		builder.show();
	}


}